<?php if (!defined('NOVA_RUN')) die('You can\'t access this file directly!');

/*
-------------------------------------------------------
*
*   NovaBoard 2
*   Copyright © 2011 NovaBoard team
*
*--------------------------------------------------------
*
*   Official site: www.novaboard.net
*   Contact e-mail: support@novaboard.net
*
*   GNU General Public License, version 2:
*   http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
---------------------------------------------------------
*/

class Template_Model extends Model {

	// Template Helper
	public function __construct()
	{
		parent::__construct();
	}
	
	public function makeIndexCatTree(&$cats, $path = 0)
	{
		$html = '';
		foreach ($cats as &$cat)
		{
			if ($path == 0)
			{
				if ($cat['permissions']['view'] == 1)
				{
					$html .= '<h3>'.$cat['name'].'</h3>';
					if (sizeof($cat['children']) > 0)
						$html .= $this->makeIndexCatTree($cat['children'], 1);
				}
			}
			else if ($path == 1)
			{
				if ($cat['permissions']['view'] == 1)
				{
					$html .= '<h4>'.$cat['name'].'</h4>';
					if (sizeof($cat['children']) > 0)
						$html .= $this->makeIndexCatTree($cat['children'], 2);
				}
			}
			else if ($path == 2)
			{
				if ($cat['permissions']['view'] == 1)
				{
					$html .= '<h5>'.$cat['name'].'</h5>';
				}
			}
		}
		return $html;
	}
}